'use strict';
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
function b(a, o, u, r) {
  let e = '';
  if (a) {
    let t = !1,
      s = '';
    for (const c of a) {
      const { source: n, type: l } = c;
      switch (l) {
        case 'space':
          t = !0;
          break;
        case 'comment': {
          u &&
            !t &&
            r(
              c,
              'MISSING_CHAR',
              'Comments must be separated from other tokens by white space characters',
            );
          const i = n.substring(1) || ' ';
          e ? (e += s + i) : (e = i), (s = '');
          break;
        }
        case 'newline':
          e && (s += n), (t = !0);
          break;
        default:
          r(c, 'UNEXPECTED_TOKEN', `Unexpected ${l} at node end`);
      }
      o += n.length;
    }
  }
  return { comment: e, offset: o };
}
exports.resolveEnd = b;
